import request from '@/utils/request'

// 查询库存变动记录列表
export function listStockChange(query) {
  return request({
    url: '/api/inventory/changes',
    method: 'get',
    params: query
  })
}

// 查询指定商品的库存变动记录
export function listStockChangeByProduct(productId, query) {
  return request({
    url: `/api/inventory/changes/product/${productId}`,
    method: 'get',
    params: query
  })
}

// 查询关联单据的库存变动记录
export function listStockChangeByRelated(relatedType, relatedId, query) {
  return request({
    url: '/api/inventory/changes/related',
    method: 'get',
    params: {
      ...query,
      relatedType,
      relatedId
    }
  })
}
